<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Config_model extends CI_Model
{
    public $cid;
    public $title;
    public $description;
    public $keyword;
    public $sitelogo;
    public $statistics;
    public $copyright;
    public $icp;
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    public function Get_Config()
    {
        return $this->db->select()->from('config')->where('cid>0')->get()->retsult();
    }
     public function Get_Config_FirstRow()
     {
       return  $this->db->select()->from('config')->where('cid>0')->get()->row();
     }
     public function Inset_Config($configModel)
    {

        $this->db->insert('config',$configModel);
        return $this->db->affected_rows();
    }
    public function Update_Config($configModel)
    {
        $res=$this->db->update('config',$configModel,array('cid'=>$configModel->cid));
        return $this->db->affected_rows();
    }

    public function DelConfig_ById($cid)
    {
        $res= $this->db->delete('config',array('cid'=>$cid));
        return $this->db->affected_rows();
    }
}
?>
